package com.aspose.cells;

import java.util.ArrayList;
import java.util.HashMap;

class zbqf extends CollectionBase {
   public zbqg a(int var1) {
      return (zbqg)this.a.get(var1);
   }

   public int[] a(WorksheetCollection var1) {
      int var2 = -1;

      int var3;
      for(var3 = 0; var3 < this.getCount(); ++var3) {
         zbqg var4 = this.a(var3);
         if (var4.a() == 5) {
            var2 = var3;
            break;
         }
      }

      if (var2 == -1) {
         zbqg var5 = new zbqg(5);
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)var5);
         var2 = this.a.size() - 1;
      }

      var3 = var1.q().a(var2, 65534, 65534);
      return new int[]{var3, var2, 65534, 65534};
   }

   public int a(zbqg var1) {
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
      return this.getCount() - 1;
   }

   int a(String var1) {
      for(int var2 = 0; var2 < this.getCount(); ++var2) {
         zbqg var3 = this.a(var2);
         if (com.aspose.cells.b.a.zv.b(var3.k(), var1)) {
            return var2;
         }
      }

      return -1;
   }

   int a(String var1, String var2, boolean var3) {
      for(int var4 = 0; var4 < this.getCount(); ++var4) {
         zbqg var5 = this.a(var4);
         if (var5.a() == 4 && com.aspose.cells.b.a.zv.b(var5.k(), var2)) {
            return var4;
         }
      }

      if (var3) {
         zbqg var6 = new zbqg(4);
         this.a(var6);
         var6.a(var1, var2);
         return this.getCount() - 1;
      } else {
         return -1;
      }
   }

   int b(zbqg var1) {
      for(int var2 = 0; var2 < this.getCount(); ++var2) {
         zbqg var3 = this.a(var2);
         if (var3.a() == var1.a()) {
            if (var3.i() == null) {
               if (var1.i() == null) {
                  return var2;
               }
            } else if (var1.i() != null && com.aspose.cells.b.a.zv.b(var3.i().toLowerCase(), var1.i().toLowerCase())) {
               return var2;
            }
         }
      }

      return -1;
   }

   int a(WorksheetCollection var1, WorksheetCollection var2, int var3, HashMap var4) {
      zbqg var5 = var2.v().a(var3);
      String[] var6 = null;
      boolean var7 = true;
      zbqg var8;
      int var10;
      int var11;
      if (var5.e()) {
         var8 = new zbqg();
         var11 = this.a.size();
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)var8);
         String var9 = var2.n().getFileName();
         if (var9 == null || "".equals(var9)) {
            var9 = "Book1" + (var2.n().k() ? ".xlsx" : ".xls");
         }

         var6 = new String[var2.getCount()];

         for(var10 = 0; var10 < var2.getCount(); ++var10) {
            var6[var10] = var2.get(var10).getName();
         }

         var8.a(var9, var6, 0);
      } else {
         var8 = new zbqg();
         var8.d(var5.i());
         var8.a(var5.a());
         var11 = this.a.size();
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)var8);
         if (var5.c() != null) {
            var6 = new String[var5.c().length];
            System.arraycopy(var5.c(), 0, var6, 0, var6.length);
            var8.a(var6);
         }

         var8.a(var5.b());
      }

      for(int var12 = 0; var12 < var2.q().getCount(); ++var12) {
         zur var13 = var2.q().b(var12);
         if ((var13.a & '\uffff') == var3) {
            var10 = var1.q().a(var11, var13.b, var13.c);
            if (var4.get(var12) == null) {
               var4.put(var12, var10);
            }
         }
      }

      return var11;
   }

   static int[] a(WorksheetCollection var0, String var1) {
      String[] var2 = com.aspose.cells.b.a.zv.d(var1, '!');
      var1 = var2[0];
      String var3 = var2[1];
      if (var3.charAt(0) == '\'') {
         var3 = var3.substring(1, 1 + (var3.length() - 2));
      }

      int var4 = -1;
      zbqf var5 = var0.v();
      boolean var6 = true;
      zbqg var7 = null;
      int var15;
      if (var1 != null && var1.length() > 2 && var1.charAt(0) == '[' && var1.charAt(var1.length() - 1) == ']' && zapb.b(var1.substring(1, 1 + (var1.length() - 2)))) {
         var1 = var1.substring(1, 1 + (var1.length() - 2));
         var4 = com.aspose.cells.b.a.zo.a(var1);
         var7 = var5.a(var4);
         var15 = var0.q().f(var4, 65534, 65534);
      } else {
         String[] var8 = com.aspose.cells.b.a.zv.d(var1, '|');
         String var9 = null;
         String var10 = null;

         for(int var11 = 0; var11 < var5.getCount(); ++var11) {
            zbqg var12 = var5.a(var11);
            if (var12.a() == 3 || var12.a() == 4) {
               String[] var13 = new String[]{var9};
               String[] var14 = new String[]{var10};
               var12.a(var13, var14);
               var9 = var13[0];
               var10 = var14[0];
               if (com.aspose.cells.b.a.zv.b(var9, var8[0]) && com.aspose.cells.b.a.zv.b(var10, var8[1])) {
                  var4 = var11;
                  break;
               }
            }
         }

         if (var4 != -1) {
            var7 = var5.a(var4);
            var15 = var0.q().f(var4, 65534, 65534);
         } else {
            var7 = new zbqg(3);
            var7.a(var8[0], var8[1]);
            var5.a(var7);
            var4 = var5.getCount() - 1;
            var15 = var0.q().b(var4, 65534, 65534);
         }
      }

      ArrayList var16 = var7.b();
      int var17 = -1;

      for(int var18 = 0; var18 < var16.size(); ++var18) {
         zuk var20 = (zuk)var16.get(var18);
         if (com.aspose.cells.b.a.zv.b(var20.e(), var3)) {
            var17 = var18;
            break;
         }
      }

      if (var17 == -1) {
         zuk var19;
         if (var16.size() == 0) {
            var17 = 0;
            var19 = new zuk(var7);
            var19.a(var3);
            com.aspose.cells.b.a.a.ze.a(var16, (Object)var19);
            var19 = new zuk(var7);
            var19.a("StdDocumentName");
            com.aspose.cells.b.a.a.ze.a(var16, (Object)var19);
         } else {
            var19 = new zuk(var7);
            var19.a(var3);
            if ("StdDocumentName".equals(((zuk)var16.get(var16.size() - 1)).e())) {
               var17 = var16.size() - 1;
               var16.add(var17, var19);
            } else {
               com.aspose.cells.b.a.a.ze.a(var16, (Object)var19);
               var17 = var16.size() - 1;
            }
         }
      }

      int[] var21 = new int[]{var15, var17 + 1};
      return var21;
   }

   // $FF: synthetic method
   public Object get(int x0) {
      return this.a(x0);
   }
}
